package com.example.design_pattern.memento.in;

public class Client {

    public static void main(String[] args){
        OriginatorIn originatorIn = new OriginatorIn();
        originatorIn.setState1("ccc");
        CaretakerrIn caretakerrIn = new CaretakerrIn();
        caretakerrIn.saveMemento(originatorIn.createMemento());//负责人保存备忘录对象

        originatorIn.setState1("ddd");
        System.out.println(originatorIn.getState1());
        originatorIn.restore(caretakerrIn.rertrieveMemento());//发起人通过备忘录恢复状态
        System.out.println(originatorIn.getState1());
    }

}
